package com.ruoyi.crm.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.mybatis.core.page.PageQuery;
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
import com.ruoyi.crm.domain.TrackingRecord;
import com.ruoyi.crm.mapper.TrackingRecordMapper;
import com.ruoyi.crm.service.ITrackingRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Map;

@RequiredArgsConstructor
@Service
public class TrackingRecordServiceImpl implements ITrackingRecordService {

    private final TrackingRecordMapper trackingRecordMapper;

    /**
     * 查询跟进记录列表
     */

    @Override
    public TableDataInfo<TrackingRecord> selectTrackingPageList(TrackingRecord trackingRecord, PageQuery pageQuery) {
        Map<String, Object> params = trackingRecord.getParams();
        LambdaQueryWrapper<TrackingRecord> query = new LambdaQueryWrapper<>();


        Page<TrackingRecord> page=trackingRecordMapper.selectPage(pageQuery.build(),query);
        return TableDataInfo.build(page);

    }
    /**
     * 根据跟进记录ID查询获取详细信息
     */

    @Override
    public TrackingRecord selectTrackingById(Long trackingId) {
        return trackingRecordMapper.selectById(trackingId);
    }

    /**
     * 删除跟进记录
     * @param trackingId
     * @return
     */

    @Override
    public int delectTrackingById(Long trackingId) {
        return trackingRecordMapper.deleteById(trackingId);
    }
}
